<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
   <title>FishVideo</title>
   <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
   <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
   <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
     <style >
	   .suoluetu{
	    margin:0 auto;
	    width:95%;
	   }
		a:link,a:visited{
			text-decoration:none;  /*超链接无下划线*/
		}
		.xinfo{
			font-size:15px;
		}
	   .daohang-lable{
		   margin-left:2%;
		   height:80px;
		   font-size:40px;
		   
	   }
	   .togo{
		font-size:20px;
	   }
	   #pageButton{
			width:80%;
			margin-left:10%;
	   }
	   #left{
			width:50%;
			
	   }
	   #right{
			width:50%;
			margin-left:50%;
			
	   }
	   #footer{
			width:100%;
			text-align:center;
	   }
     </style>
	 <script>
	 	var istrue=false;
		function test(){
			var s1=document.getElementById("pwd").value;
			var s2=document.getElementById("rpwd").value;
			var s3 =document.getElementById("clogodiv");
			if(s1!=s2){
			s3.innerHTML="错误";
			alert("两次密码输入不一致！");
			s3.style.color="red";
			istrue=false;
			}else if(s1!="" && s1==s2){
			 s3.style.color="blue";
			  s3.innerHTML="正确";
			  istrue=true;
			}
		}
	</script>

</head>
<body>
<nav class="navbar navbar-inverse" role="navigation">
   <div class="navbar-header">
      <a class="navbar-brand" href="index.php">FishVideo</a>
   </div>
   <div>
      <ul class="nav navbar-nav">
	  <?php
			require_once("utils/db.php");
			$conn=connect();
			$realpath="video/upload/";		
			$sql="select * from fishvideo_videotype";
			$result=mysql_query($sql);
			$i=0;
			while($trow=mysql_fetch_array($result)){
				$typearray[$i++]=$trow;
				echo "<li><a href='video/typedet.php?tid={$trow['yjl_tid']}'>
					{$trow['yjl_typename']}</a></li>";
			}
	  ?>
      </ul>
   </div>
     <form   action="video/typedet.php" class="navbar-form navbar-left" role="search" method="POST">
        <div class="form-group">
          <input type="text" class="form-control"  name="videoname" placeholder="搜索电影">
        </div>
        <button type="submit" name="search" class="btn btn-default">搜索</button>
      </form>
    <ul class="nav navbar-nav navbar-right">
		<?php
			session_start();
			if(isset($_SESSION['username'])){
			  echo "<li><a href='#' ><span class='glyphicon glyphicon-user'></span>{$_SESSION['username']}</a></li>";
			  echo " <li><a href='user/user_exit.php'><span class='glyphicon glyphicon-off'></span>注销</a></li>";
			}else{
			  echo " <li><a href='#' data-toggle='modal'  data-target='#login'>登陆</a></li>";
			  echo " <li><a href='#' data-toggle='modal'  data-target='#register'>注册</a></li>";
			}
		?>    
		<li><a>&nbsp&nbsp&nbsp&nbsp</a></li>
     </ul>
</nav>
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="2000">
   <!-- 轮播（Carousel）指标 -->
   <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
	  <li data-target="#myCarousel" data-slide-to="3"></li>
   </ol>   

   <div class="carousel-inner">
	  <div class="item active">
         <img src="image/00.jpg"  alt="0 slide">
      </div>
      <div class="item">
         <img src="image/01.jpg"  alt="First slide">
      </div>
      <div class="item">
         <img src="image/02.jpg"  alt="Second slide">
      </div>
      <div class="item">
         <img src="image/03.jpg"  alt="Third slide">
      </div>
   </div>
  	 <!-- 轮播（Carousel）导航 -->
   <a class="carousel-control left" href="#myCarousel" 
      data-slide="prev">&lsaquo;</a>
   <a class="carousel-control right" href="#myCarousel" 
      data-slide="next">&rsaquo;</a>
   <!-- 轮播（Carousel）项目 -->
</div> 
	<?php
		$j=0;
		for($j=0;$j<4;$j++){
		echo "<span class='daohang-lable'><a  class='info' href='video/typedet.php?tid={$typearray[$j]['yjl_tid']}'>{$typearray[$j]['yjl_typename']}</a>
		<a href='video/typedet.php?tid={$typearray[$j]['yjl_tid']}' class='togo'>更多>></a></span>
		<hr>
		<div class='suoluetu'>";
		$sql="select * from fishvideo_video where yjl_tid='{$typearray[$j]['yjl_tid']}' limit 0,8";
		$result=mysql_query($sql);
		$i=-1;
		echo "<div class='row'>";
		while($row=mysql_fetch_array($result)){
			$i++;
			if($i==4){ echo "</div><div class='row'>";};
			echo "
			<div class='col-sm-3 col-md-3'>
			  <div  class='thumbnail' onClick='window.location.href='#''
			  style='cursor:pointer;'>'
			  	 <img src='{$realpath}{$row['yjl_pic']}' href='video/videodet.php?vid={$row['yjl_vid']}'
				 alt='通用的占位符缩略图'>
				 <div class='caption'>
					<h3>{$row['yjl_videoname']}</h3>
					<a class='xinfo' href='video/videodet.php?vid={$row['yjl_vid']}'>{$row['yjl_lintro']}</a>
				 </div>
			  </div>
		   </div>";
		}
		echo "</div>";
		}
	?>
<hr>
<div id="footer">
	<p>Copyright © 2016-2017 FishVideo.com All Rights Reserved</p>
	<p>站长邮箱:574153393@qq.com</p>
</div>
<!-- 模态框（Modal）（登陆） -->
<div class="modal fade" id="login" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
	   <div class="modal-dialog">
		  <div class="modal-content">
			 <div class="modal-header">
				<button type="button" class="close" 
				   data-dismiss="modal" aria-hidden="true">
					  &times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
				   登陆
				</h4>
			 </div>
			 <!--登陆主体 -->
			 <div class="modal-body">
			   <form action="user/doUserLogin.php" method="POST" role="form" >
				<table class="table">
					<tr>
						<th>用户名:</th><td><input type="text" name="user" 
						class="form-control" 
						placeholder="user"></td>
					</tr>
					<tr>
						<th>密码:</th><td><input type="password" name="pwd" 
						class="form-control"
						placeholder="password"></td>
					</tr>
				</table>
				<input type="submit" name="sub" class="btn-block btn-lg btn-primary" value="登陆">
			</form>
			 </div>
		  </div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

<!-- 模态框（Modal）（注册） -->
<div class="modal fade" id="register" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
	   <div class="modal-dialog">
		  <div class="modal-content">
			 <div class="modal-header">
				<button type="button" class="close" 
				   data-dismiss="modal" aria-hidden="true">
					  &times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
				   请填写注册信息
				</h4>
			 </div>
			 <!--登陆主体 -->
			 <div class="modal-body">
		<form role="form" action="user/doReg.php" method="post" enctype="multipart/form-data">
		<table class="table" align="center">
		<tr><th>姓名</th><td><input type="text" class="form-control" id="name" name="name"
		required oninvalid="setCustomValidity('请填写姓名')"
					oninput="setCustomValidity('')"></td></tr>
			<tr>
				<th>
				 创建密码：
				</th>
				<td>
					<input type="password" name="pwd" id="pwd" class="form-control" placeholder="password" required oninvalid="setCustomValidity('请填写密码')"
					oninput="setCustomValidity('')">
				</td>
			</tr>
			<tr>
				<th>
				 确认密码：
				</th>
				<td>
					<input type="password" name="rpwd" id="rpwd" class="form-control" required="required" placeholder="password"
					onblur="test()" required oninvalid="setCustomValidity('请再次填写密码')"
					oninput="setCustomValidity('')">
				</td>
				<td>
					<p id="clogodiv">
						
					</p>
				</td>
			</tr>
		<tr><th>性别</th>
		<td colspan="2">
		<input type="radio"  name="sex" value="0"checked>男
		<input type="radio"  name="sex" value="1">女</td></tr>
		<tr><th>生日</th><td><input type="date" id="bir" name="bir" class="form-control"></td></tr>
		<tr><th>爱好</th>
		<td colspan="5">
		<input type="checkbox" name="like[]" checked value="旅游">旅游</radio>
		<input type="checkbox" name="like[]" value="登山">登山</radio>
		<input type="checkbox" name="like[]" value="健身">健身</radio>
		<input type="checkbox" name="like[]" value="上网">上网</radio>
		<input type="checkbox" name="like[]" value="游泳">游泳</radio>
		</td></tr>
		<tr>
		<th>学历</th>
		<td>
		<select name="xl" class="form-control" required oninvalid="setCustomValidity('请选择学历')"
					oninput="setCustomValidity('')">
		  <option  disabled selected>请选择</option>
		  <option value ="0" >高中</option>
		  <option value ="1">大学</option>
		  <option value="2">研究生</option>
		  <option value="3">博士</option>
		</select>
		</td>
		</tr>
		<tr>
		<th>自我介绍</th><td><textarea name="zwjs" class="form-control" rows="3" cols="20"
		placeholder="性格，习惯...."></textarea></td>
		</tr>
		<tr>
		<th>头像</th><td><input type="file" name="tx" class="form-control" ></td>
		</tr>
	</table>
	<div id="pageButton">
		<span id="left">
		<button type="button" class="btn btn-default" 
               data-dismiss="modal">关闭
            </button>
		</span>
		<span id="right">
            <button type="submit" class="btn btn-primary">
               注册
            </button>
		</span>
    </div>
	 </form>
	 </div>
	</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
</body>
</html>